home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / rjs.lha / RJS / Transport / tests / rdaytime.C < prev    next >
C/C++ Source or Header  |  1991-06-14  |  559b  |  27 lines

  1. #include <iostream.h>
  2. #include "RJS/Transport.h"
  3. #include <osfcn.h>
  4. #include <libc.h>
  5.  
  6. int main(int argc, char *argv[]) 
  7. {
  8.   if (argc!=2) {
  9.     cerr << "usage: " << argv[0] << " host" << endl;
  10.     exit(1);
  11.   }
  12.  
  13.   RJS_InetAddress daytime_address(argv[1],"daytime","udp");
  14.   RJS_InetDatagram daytime_server;
  15.  
  16.   daytime_server.active();
  17.   daytime_server.sendto("time please",12,daytime_address); // send to server
  18.  
  19.   char buffer[512]; 
  20.   int nbr=daytime_server.recv(buffer,512);    // get reply
  21.   buffer[nbr]=0;
  22.  
  23.   cout << "rdaytime => " << buffer << endl;
  24.   exit(0);
  25. }
  26.  
  27.